class Solution {
public:
    string getHint(string secret, string guess) {
        int bulls=0,cows=0;
        int buffer_a[26]={0};
        int buffer_b[26]={0};
        string ans;   
        for(int i=0;i<secret.length();i++){
            if(secret[i]==guess[i]){bulls++;}
            buffer_a[secret[i]-'0']++;
            buffer_b[guess[i]-'0']++;
        }
        for(int i=0;i<26;i++){
            cows+=min(buffer_a[i],buffer_b[i]);
        }
        ans=to_string(bulls)+"A"+to_string(cows-bulls)+"B";
        return ans;
    }
};